<template>
	<view class="news">
		<news-item @itemClick="goDetail" :list="newsList"></news-item>
	</view>
</template>

<script>
	import newsItem from '../../components/news-item/news-item.vue'
	export default {
		data() {
			return {
				newsList: [{
						img: '../../static/contact/guanyu.jpg',
						title: '尼玛世界',
						date: '2020-06-30',
						count: '124'
					}

				]
			}
		},
		//注册组件
		components: {
			"news-item": newsItem
		},
		methods: {
			//获取数据
			async getNews() {
				const res = await this.$myRequest({
					url: ''
				})
				this.newsList = res.data.message
			},
			//跳转页面
			goDetail(index){
				uni.navigateTo({
					url:'/pages/news-detail/news-detail?id='+index
				})
			}

		},
		onLoad() {
			//getNews()
		}
	}
</script>

<style lang="scss">
	.news {}
</style>
